package com.starryx.websocket.chatroom.net.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "net")
public class NetConfig {
    /**
     * 服务器 ip 地址
     */
    private String ip = "127.0.0.1";

    /**
     * 服务器端口
     */
    private int port = 9527;

    /**
     * 负责连接的 EventLoop 的线程数
     */
    private short bossGroupThread = 1;

    /**
     * 负责读写的 EventLoop 的线程数
     */
    private int workerGroupThread = Runtime.getRuntime().availableProcessors();

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public short getBossGroupThread() {
        return bossGroupThread;
    }

    public void setBossGroupThread(short bossGroupThread) {
        this.bossGroupThread = bossGroupThread;
    }

    public int getWorkerGroupThread() {
        return workerGroupThread;
    }

    public void setWorkerGroupThread(int workerGroupThread) {
        this.workerGroupThread = workerGroupThread;
    }
}
